/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.applicatioN.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Slim
 */
@Entity
@Table(name = "grade")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Grade.findAll", query = "SELECT g FROM Grade g"),
    @NamedQuery(name = "Grade.findByNomGrade", query = "SELECT g FROM Grade g WHERE g.nomGrade = :nomGrade")})
public class Grade implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "NOM_GRADE")
    private String nomGrade;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "grade")
    private Collection<TravaillerAvec> travaillerAvecCollection;

    public Grade() {
    }

    public Grade(String nomGrade) {
        this.nomGrade = nomGrade;
    }

    public String getNomGrade() {
        return nomGrade;
    }

    public void setNomGrade(String nomGrade) {
        this.nomGrade = nomGrade;
    }

    @XmlTransient
    public Collection<TravaillerAvec> getTravaillerAvecCollection() {
        return travaillerAvecCollection;
    }

    public void setTravaillerAvecCollection(Collection<TravaillerAvec> travaillerAvecCollection) {
        this.travaillerAvecCollection = travaillerAvecCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (nomGrade != null ? nomGrade.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Grade)) {
            return false;
        }
        Grade other = (Grade) object;
        if ((this.nomGrade == null && other.nomGrade != null) || (this.nomGrade != null && !this.nomGrade.equals(other.nomGrade))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.applicatioN.entities.Grade[ nomGrade=" + nomGrade + " ]";
    }
    
}
